package band.wukong.practice.javase.core.io.typicalUsage;

import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;

/**
 * Desc: 缓冲输入文件
 * Author: sunjs
 * Date: 2009-12-17 15:34:21
 */
public class BufferedInputFile {
    private static final String FILE_IN = "src/com/jsun/javase/corepackage/io/testdir/poem.txt";

    public static String read(String fileName) throws IOException {
        BufferedReader in = new BufferedReader(new FileReader(fileName));


        StringBuilder sb = new StringBuilder();
        String line ;
        while((line = in.readLine()) != null) {
            sb.append(line).append("\n");
        }
        in.close();
        return sb.toString();
    }

    public static void main(String[] args) throws IOException {
        System.out.println(read(FILE_IN));
    }
}
